#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#

# -*- mode: python; -*-

import platform
if platform.system() == 'Darwin':
    Return()

Import('AgentEnv')
env = AgentEnv.Clone()

# test specific modifications
AgentEnv.MakeTestEnv(env)

env.Append(CPPPATH = './')
env.Append(CPPPATH = '../')
env.Append(CPPPATH = ['../../../oper/test/'])
env.Append(CPPPATH = ['../../../test-xml/'])
env.Append(LIBPATH = ['./'])
env.Append(LIBPATH = ['../'])
env.Append(LIBPATH = ['../../../oper/test/'])
env.Append(LIBPATH = ['../../../test-xml/'])
env.Append(LIBS = [ 'control_node_mock'])
env.Prepend(LIBS = [ 'ovsdbclient', 'openvswitch'])
env.Prepend(LIBS = [ 'test_ovs_agent_init'])
env.Append(LIBS = ['ssl', 'crypto'])
env.Append(LIBS = [
                   'agent_test_xml',
                   'agent_oper_test_xml',
                   'agent_physical_devices_test_xml',
                   'agent_ovsdb_test_xml'])

env.Library('agent_ovsdb_test_xml', 'test_xml_ovsdb.cc')

TestSandeshGenFiles = env.SandeshGenCpp('test_ovsdb.sandesh')
TestSandeshGenSrcs = env.ExtractCpp(TestSandeshGenFiles)
test_sandesh_objs = AgentEnv.BuildExceptionCppObj(env, TestSandeshGenSrcs)

env.Library('test_ovs_agent_init',
            test_sandesh_objs +
            [
                'test_ovs_agent_init.cc',
                'test_ovs_agent_util.cc',
                'test_ovsdb_sandesh.cc'
            ])

agent_suite = []
flaky_agent_suite = []
disabled_ovsdb_suite = []
AgentEnv.MakeTestCmd(env, 'test_ovs_route', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_base', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_logical_switch', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_multicast_local', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_unicast_remote', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_unicast_local', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_ha_stale', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_vlan_port', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_event', agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_base_ssl', flaky_agent_suite)
AgentEnv.MakeTestCmd(env, 'test_ovs_resource_vxlanid', agent_suite)

AgentEnv.MakeTestCmd(env, 'test_agent_route_export', disabled_ovsdb_suite)

env.TestSuite('ovsdb_client:flaky_test', flaky_agent_suite)
flaky_test = env.TestSuite('agent-flaky-test', flaky_agent_suite)

env.TestSuite('ovsdb_client:test', agent_suite)
test = env.TestSuite('agent-test', agent_suite)
env.Alias('agent:agent_test', test)
Return('agent_suite')
